<!--项目（合同）台账每日成本统计-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="renderer" content="webkit">
<!-- TopJUI框架样式 -->
<link type="text/css" href="../../general/topjui/themes/default/topjui.core.min.css" rel="stylesheet">
<link type="text/css" href="../../general/topjui/themes/default/topjui.blue.css" rel="stylesheet" id="dynamicTheme" />
<!-- FontAwesome字体图标 -->
<link type="text/css" href="../../general/static/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
<!-- layui框架样式 -->
<link type="text/css" href="../../general/static/plugins/layui/css/layui.css" 	rel="stylesheet" />
<!-- jQuery相关引用 -->
<script type="text/javascript" src="../../general/static/plugins/jquery/jquery.min.js"></script>
<script type="text/javascript" src="../../general/static/plugins/jquery/jquery.cookie.js"></script>
<!-- TopJUI框架配置 -->
<script type="text/javascript" src="../../general/static/public/js/topjui.config.js"></script>
<!-- TopJUI框架核心-->
<script type="text/javascript" src="../../general/topjui/js/topjui.core.min1.js"></script>
<!-- TopJUI中文支持 -->
<script type="text/javascript" src="../../general/topjui/js/locale/topjui.lang.zh_CN.js"></script>
<!-- layui框架js -->
<script type="text/javascript" src="../../general/static/plugins/layui/layui.js" charset="utf-8"></script>

<!--自定义的样式与js-->
<link type="text/css" href="../a_allcommon/all.css" 	rel="stylesheet" />
<script type="text/javascript" src="../a_allcommon/all.js"></script>

</head>
<body>
	<div class="page_box">
		<!--title以及查询区div开始-->
		<div class="tjfx">
			<span style="padding: 10px;"></span>
			<div class="tjfx_title" id="t_t"></div>
			<div class="tjfx_query">
				<div class="lineL" style="width:80px;">项目名称：</div>
				<div class="lineR" style="width:150px;">
					<input type="text" name="q_tz_xiangmu_name" id="q_tz_xiangmu_name"
					       data-toggle="topjui-combobox"
					       data-options="prompt:'请选择项目名称',
					                  	 panelHeight:150,
					                   	 valueField:'zidian_value',
					                   	 textField:'zidian_value'">
				</div>
				<div class="lineL" style="width:60px;">年月：</div>
				<div class="lineR line2R">
					<input type="text" name="q_start_time"
					       data-toggle="topjui-datebox" 
								 data-options="id:'q_start_time',prompt:'请选择年月',width:150">
				</div>
				<div class="lineL"  style="width:70px;">供餐日：</div>
				<div class="lineR line2R" style="width:50px;">
					<input id="q_tz_gongzuori" type="text" name="q_tz_gongzuori"
					       data-toggle="topjui-numberbox"
					       data-options="prompt:'请输入',min:1,max:30,width:150">
				</div>
				<span style="padding: 10px;"></span>
				<a href="javascript:doSubmit()" data-toggle="topjui-menubutton"
					 data-options="iconCls:'fa fa-search',btnCls:'topjui-btn-blue'">查询</a>
				<span style="padding: 5px;"></span>
				<a href="javascript:void(0)" data-toggle="topjui-menubutton"
					 data-options="btnCls:'topjui-btn-green'" onclick="exportExcel()">生成excel</a>
			</div>
		</div>
		<!--title以及查询区div结束-->
		
		<div class="grid_box">
			<!-- datagrid表格（fitColumns:true表示限制滚动条，fitColumns:false表示允许滚动条）-->
			<table data-toggle="topjui-datagrid" class="productDg1" 
			       data-options="id:'c_tjfxTable',fitColumns:false,remoteSort:false,pagination:false,rownumberWidth:39">
				<thead>
					<tr>
						<th data-options="field:'riqi',title:'年月',sortable:true,width:100,align:'center'"></th>
						<th data-options="field:'xingqi',title:'周',sortable:true,width:60,align:'center'"></th>
						<th data-options="field:'shucai',title:'蔬菜',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'liangshi',title:'粮食',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'zaliang',title:'杂粮',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'mianshi',title:'面食',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'danlei',title:'蛋类',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'fushi',title:'副食',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'banchengpin',title:'半成<br>品',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'tiaoliao',title:'调料',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'ganhuo',title:'干货',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'shiyongyou',title:'食用<br>油',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'qinlei',title:'禽类',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'chulei',title:'畜类',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'shuichan',title:'水产',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'yinliao',title:'饮料',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'shuiguo',title:'水果',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'gaodian',title:'糕点',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'dizhi',title:'低值',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'tianjiaji',title:'添加<br>剂',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'qita',title:'其他',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'wuyeyongpin',title:'物业<br>用品',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'jihuawai',title:'计划<br>外',sortable:true,width:80,align:'center'"></th>
						<th data-options="field:'meiriheji',title:'每日合计',sortable:true,width:100,align:'center'"></th>
					</tr>
				</thead>
			</table>
		</div> <!--表格区div结束-->
		
	</div>
<script>
var HTMC_LIST=[]; //用于保存字典中项目名称下拉框的数据
$(function(){
	riqi_YM("#q_start_time");
	getA_ZDList("项目名称"); //取字典中项目名称集合
});
//根据键名取字典中的键值列表（用于填充项目名称、结款方式、验收人、这三个选择下拉）
function getA_ZDList(zidian_name){
	var formData={};
	formData.zidian_name=zidian_name;
	$.ajax({
		url:"/a_ZD/getA_ZDList",
		dataType:"JSON",
		type:"POST",
		data:formData,
		success:function(data){
			console.log("获取字典中键名为"+zidian_name+"的键值集合返回值data.rows==",data.rows);
			if(zidian_name=="项目名称"){
				HTMC_LIST=data.rows;
				$('#q_tz_xiangmu_name').iCombobox('loadData',HTMC_LIST);
			}
		}
	});
}

/*************************************表格相关方法****************************************/
/********使用ajax返回的数据的方式加载表格（如下2个主要方法）*******/
//表格主查询（包含条件查询）
function doSubmit(){
	$('#t_t').text(''); //标题区先初始化
	var formData={};
	//1：取查询参数 
	var q_tz_xiangmu_name=$('#q_tz_xiangmu_name').iCombobox('getValue'); //项目名称
	if(q_tz_xiangmu_name==""){
		$.iMessager.alert('警告', '请选择项目！', 'messager-warning');
		return;
	}else{
		formData.tz_xiangmu_name=q_tz_xiangmu_name;
	}
	var q_start_time=$('#q_start_time').iDatebox('getValue'); //年月
	if(q_start_time==""){
		$.iMessager.alert('警告', '请选择年月！', 'messager-warning');
		return;
	}else{
		formData.start_time=q_start_time+"-01 00:00:00";
	}
	var q_tz_gongzuori=$('#q_tz_gongzuori').iNumberbox('getValue'); //供餐日天数
	if(q_tz_gongzuori==""){
		$.iMessager.alert('警告', '请输入当月供餐日天数！', 'messager-warning');
		return;
	}else{
		formData.tz_gongzuori=q_tz_gongzuori;
	}
	//2：标题区赋值
	$('#t_t').text('项目：'+q_tz_xiangmu_name+'  '+q_start_time+'（'+q_tz_gongzuori+'天供餐日） 每日成本统计'); 
	debugger;
	//2：执行ajax查询请求
	$.ajax({
		url:"/c_Tjfx/getHzxx_meiri_leibie",
		dataType:"JSON",
		type:"POST",
		data:formData,
		success:function(data){
			console.log(data.rows);
			debugger;
			//3：加载表格
			$("#c_tjfxTable").iDatagrid("loadData",data);//表格装载数据
		}
	});
}

</script>
</body>
</html>